import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:syn_4s/core/services/setting_request.dart';
import 'package:syn_4s/core/utils/toast_utils.dart';

import '../services/config.dart';

class AboutUsViewModel extends GetxController {
  var contentCn = "".obs;
  var contentEn = "".obs;
  var phone = "".obs;
  var email = "".obs;
  RxList<String> content = <String>[].obs;

  AboutUsViewModel(BuildContext context) {
    SettingRequest.getAboutUs().then((value) {
      if (value.status != HttpConfig.success) {
        ToastUtils.showToast(value.message ?? "");
        return;
      }
      content.addAll(value.data?.content?.split("\\n") ?? []);
    }).catchError((err) {
      ToastUtils.showNetError(context);
    });
  }
}
